package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;

class zbbr {
   private static final com.aspose.cells.b.c.a.za b = new com.aspose.cells.b.c.a.za(new String[]{"Title", "Subject", "Author", "Keywords", "Comments", "Last Author", "Revision Number", "Application Name", "Total Editing Time", "Last Print Date", "Number of Pages", "Number of Words", "Number of Characters", "Category", "Format", "Manager", "Company", "HyperlinkBase", "Number of Bytes", "Number of Lines", "Number of Paragraphs"});

   private static void a(WorksheetCollection var0) {
      for(int var1 = 0; var1 < var0.getCount(); ++var1) {
         Cells var2 = var0.get(var1).getCells();
         ArrayList var3 = var2.getMergedCells();

         for(int var4 = 0; var4 < var3.size(); ++var4) {
            CellArea var5 = (CellArea)var3.get(var4);
            int var6 = var2.c(var5.StartRow, var5.StartColumn);
            if (var6 == -1) {
               var6 = 15;
            }

            int var7 = var6;
            int var8 = var6;
            if (var5.StartRow != var5.EndRow || var5.StartColumn != var5.EndColumn) {
               var7 = var2.c(var5.EndRow, var5.EndColumn);
               if (var7 == -1) {
                  var7 = 15;
               }
            }

            if (var6 == var7) {
               var8 = var7;
            } else {
               Style var9 = var0.f(var6);
               Style var10 = var0.f(var7);
               if (var9.f()) {
                  if (var10.f()) {
                     Style var11 = new Style(var0);
                     var11.copy(var9);
                     var11.getBorders().getByBorderType(2).a(var10.getBorders().getByBorderType(2));
                     var11.getBorders().getByBorderType(8).a(var10.getBorders().getByBorderType(8));
                     var8 = var0.a(var11);
                  } else {
                     var8 = var6;
                  }
               } else if (var10.f()) {
                  var8 = var7;
               }
            }

            if (var8 != var6) {
               var2.a(var5.StartRow, var5.StartColumn, false).b(var8);
            }
         }
      }

   }

   static void a(Workbook var0, com.aspose.cells.b.a.d.zm var1, SaveOptions var2) throws Exception {
      var0.getWorksheets().o();
      a(var0.getWorksheets());
      var0.getWorksheets().p();
      zcfx var3 = new zcfx(var1, Encoding.getUTF8());
      boolean var4 = true;
      boolean var5 = true;
      boolean var6 = false;
      if (var2 != null && var2 instanceof SpreadsheetML2003SaveOptions) {
         var4 = ((SpreadsheetML2003SaveOptions)var2).isIndentedFormatting();
         var5 = ((SpreadsheetML2003SaveOptions)var2).getLimitAsXls();
         var6 = ((SpreadsheetML2003SaveOptions)var2).getExportColumnIndexOfCell();
      }

      if (var4) {
         var3.a((int)1);
      }

      var3.c();
      var3.d("<?mso-application progid=\"Excel.Sheet\"?>");
      var3.b("Workbook");
      var3.a("xmlns", "o", (String)null, "urn:schemas-microsoft-com:office:office");
      var3.a("xmlns", "x", (String)null, "urn:schemas-microsoft-com:office:excel");
      var3.a("xmlns", "ss", (String)null, "urn:schemas-microsoft-com:office:spreadsheet");
      var3.a((String)null, "xmlns", (String)null, "urn:schemas-microsoft-com:office:spreadsheet");
      var3.a("xmlns", "x2", (String)null, "urn:schemas-microsoft-com:office:excel2");
      var3.a("xmlns", "html", (String)null, "http://www.w3.org/TR/REC-html40");
      var3.a("xmlns", "dt", (String)null, "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882");
      a(var3, var0);
      Cells var7 = null;

      try {
         for(int var8 = 0; var8 < var0.getWorksheets().getCount(); ++var8) {
            Worksheet var9 = var0.getWorksheets().get(var8);
            var7 = var9.getCells();
            var7.d = new zkt(var7, 16383);
            var7.c = new zkx(var7, 16383);
            a(var3, var9, var4, var5, var6);
            if (var0.getSaveOptions().getClearData()) {
               var9.getCells().clear();
            }
         }
      } finally {
         if (var7 != null) {
            var7.m();
            var7.l();
         }

      }

      var3.b();
      var3.d();
      var3.e();
   }

   private static void a(zcfx var0, Workbook var1) throws Exception {
      var0.c("x:ExcelWorkbook", (String)null);
      var0.b("x:ActiveSheet", (String)null, zcfi.a(var1.getWorksheets().getActiveSheetIndex()));
      if (!var1.getSettings().getShowTabs()) {
         var0.b("x:HideWorkbookTabs", (String)null, (String)null);
      }

      if (!var1.getSettings().isHScrollBarVisible()) {
         var0.b("x:HideHorizontalScrollBar", (String)null, (String)null);
      }

      if (!var1.getSettings().isVScrollBarVisible()) {
         var0.b("x:HideVerticalScrollBar", (String)null, (String)null);
      }

      switch(var1.getSettings().getCalcMode()) {
      case 1:
         var0.b("x:Calculation", (String)null, "SemiAutomaticCalculation");
         break;
      case 2:
         var0.b("x:Calculation", (String)null, "ManualCalculation");
      }

      if (!var1.getSettings().getRecalculateBeforeSave()) {
         var0.b("x:DoNotCalculateBeforeSave", (String)null, (String)null);
      }

      var0.b();
      String var5;
      if (var1.getWorksheets().getBuiltInDocumentProperties().getCount() != 0) {
         var0.c("o:DocumentProperties", (String)null);
         Iterator var2 = var1.getWorksheets().getBuiltInDocumentProperties().iterator();

         DocumentProperty var3;
         String var4;
         while(var2.hasNext()) {
            var3 = (DocumentProperty)var2.next();
            var4 = null;
            switch(b.a(var3.getName())) {
            case 0:
               var4 = "Title";
               break;
            case 1:
               var4 = "Subject";
               break;
            case 2:
               var4 = "Author";
               break;
            case 3:
               var4 = "Keywords";
               break;
            case 4:
               var4 = "Description";
               break;
            case 5:
               var4 = "LastAuthor";
               break;
            case 6:
               var4 = "Revision";
               break;
            case 7:
               var4 = "AppName";
               break;
            case 8:
               var4 = "TotalTime";
               break;
            case 9:
               var4 = "LastPrinted";
               break;
            case 10:
               var4 = "Pages";
               break;
            case 11:
               var4 = "Words";
               break;
            case 12:
               var4 = "Characters";
               break;
            case 13:
               var4 = "Category";
               break;
            case 14:
               var4 = "PresentationFormat";
               break;
            case 15:
               var4 = "Manager";
               break;
            case 16:
               var4 = "Company";
               break;
            case 17:
               var4 = "HyperlinkBase";
               break;
            case 18:
               var4 = "Bytes";
               break;
            case 19:
               var4 = "Lines";
               break;
            case 20:
               var4 = "Paragraphs";
               break;
            default:
               var4 = null;
            }

            if (var4 != null && var3.getValue() != null) {
               var5 = com.aspose.cells.b.a.zr.a(var3.getValue());
               if (!"".equals(var5)) {
                  var0.b("o:" + var4, (String)null, com.aspose.cells.b.a.zr.a(var3.getValue()));
               }
            }
         }

         var0.b();
         if (var1.getWorksheets().getCustomDocumentProperties().getCount() != 0) {
            var0.c(true);
            var0.c("o:CustomDocumentProperties", (String)null);
            var2 = var1.getWorksheets().getCustomDocumentProperties().iterator();

            while(var2.hasNext()) {
               var3 = (DocumentProperty)var2.next();
               if (var3.getType() != 5 && !"_PID_LINKBASE".equals(var3.getName().toUpperCase()) && !var3.c()) {
                  var4 = var3.getName();
                  var0.a("o", var4, true);
                  if (var3.isLinkedToContent()) {
                     var0.a("link", var3.getSource());
                  }

                  var5 = null;
                  String var6 = null;
                  switch(var3.getType()) {
                  case 0:
                     var5 = "boolean";
                     break;
                  case 1:
                     var5 = "dateTime.tz";
                     var6 = ((DateTime)var3.getValue()).toUniversalTime().a("yyyy-MM-dd\\THH:mm:ss.fff", com.aspose.cells.b.a.c.za.b());
                     break;
                  case 2:
                     var5 = "float";
                     var6 = zase.b(var3.toDouble());
                     break;
                  case 3:
                     var5 = "float";
                     var6 = zase.y(var3.toInt());
                  }

                  if (var5 != null) {
                     var0.a("dt:dt", (String)null, var5);
                  }

                  if (var6 == null) {
                     var6 = com.aspose.cells.b.a.zr.a(var3.getValue());
                  }

                  var0.a(var6);
                  var0.a(true);
               }
            }

            var0.b();
            var0.c(false);
         }
      }

      b(var0, var1);
      boolean var8 = false;
      Iterator var9 = var1.getWorksheets().getNames().iterator();

      while(var9.hasNext()) {
         Name var10 = (Name)var9.next();
         if (var10.getRefersTo() != null && var10.getRefersTo().length() != 0 && var10.getSheetIndex() == 0) {
            if (!var8) {
               var0.c("ss:Names", (String)null);
               var8 = true;
            }

            var0.c("ss:NamedRange", (String)null);
            var0.a("ss:Name", (String)null, var10.getText());
            if (var10.j()) {
               var0.a("ss:Hidden", (String)null, "1");
            }

            try {
               var5 = var10.getR1C1RefersTo();
               var0.a("ss:RefersTo", (String)null, var5);
            } catch (Exception var7) {
               throw new CellsException(6, var10.getText() + var10.getRefersTo());
            }

            var0.b();
         }
      }

      if (var8) {
         var0.b();
      }

      a(var1, var0);
   }

   private static void b(zcfx var0, Workbook var1) throws Exception {
      boolean var2 = false;

      int var3;
      for(var3 = 8; var3 < 64; ++var3) {
         if ((Integer)var1.getWorksheets().m().b().d((Object)var3) != zbbx.d[var3 - 8]) {
            var2 = true;
            break;
         }
      }

      if (var2) {
         var0.b("o:OfficeDocumentSettings");
         var0.b("o:Colors");

         for(var3 = 8; var3 < 64; ++var3) {
            if ((Integer)var1.getWorksheets().m().b().d((Object)var3) != zbbx.d[var3 - 8]) {
               Color var4 = var1.getWorksheets().m().e(var3);
               int var5 = var4.toArgb();
               String var6 = "#" + com.aspose.cells.a.c.zp.e(var5).substring(2);
               var0.b("o:Color");
               var0.b("o:Index");
               var0.a(com.aspose.cells.b.a.zo.a(var3 - 8));
               var0.b();
               var0.b("o:RGB");
               var0.a(var6);
               var0.b();
               var0.b();
            }
         }

         var0.b();
         var0.b();
      }
   }

   private static void a(zcfx var0, Worksheet var1, Workbook var2) throws Exception {
      var0.c("ss:Names", (String)null);
      Iterator var3 = var2.getWorksheets().getNames().iterator();

      while(true) {
         Name var4;
         do {
            do {
               if (!var3.hasNext()) {
                  var0.b();
                  return;
               }

               var4 = (Name)var3.next();
            } while(var4.getRefersTo() == null);
         } while(var4.getRefersTo().length() == 0 && var4.b() != null);

         if (var4.getSheetIndex() == var1.getIndex() + 1) {
            var0.c("ss:NamedRange", (String)null);
            var0.a("ss:Name", (String)null, var4.getText());
            if (var4.j()) {
               var0.a("ss:Hidden", (String)null, "1");
            }

            String var5 = var2.getWorksheets().c().a(-1, -1, var4.b(), 0, 0, true);
            var0.a("ss:RefersTo", (String)null, var5);
            var0.b();
         }
      }
   }

   private static void b(zcfx var0, Worksheet var1, Workbook var2) throws Exception {
      HorizontalPageBreakCollection var3 = var1.getHorizontalPageBreaks();
      VerticalPageBreakCollection var4 = var1.getVerticalPageBreaks();
      if (var3.getCount() != 0 || var4.getCount() != 0) {
         var0.c("x:PageBreaks", (String)null);
         Iterator var5;
         int var7;
         if (var3.getCount() != 0) {
            var0.c("x:RowBreaks", (String)null);

            for(var5 = var3.iterator(); var5.hasNext(); var0.b()) {
               HorizontalPageBreak var6 = (HorizontalPageBreak)var5.next();
               var0.c("x:RowBreak", (String)null);
               var0.c("x:Row", (String)null);
               var0.a(zase.y(var6.getRow()));
               var0.b();
               if (var6.getStartColumn() != 1) {
                  var0.c("x:ColStart", (String)null);
                  var0.a(zase.y(var6.getStartColumn()));
                  var0.b();
               }

               var7 = var6.getEndColumn() > 255 ? 255 : var6.getEndColumn();
               if (var7 != 255) {
                  var0.c("x:ColEnd", (String)null);
                  var0.a(zase.y(var7));
                  var0.b();
               }
            }

            var0.b();
         }

         if (var4.getCount() != 0) {
            var0.c("x:ColBreaks", (String)null);

            for(var5 = var4.iterator(); var5.hasNext(); var0.b()) {
               VerticalPageBreak var8 = (VerticalPageBreak)var5.next();
               var0.c("x:ColBreak", (String)null);
               var0.c("x:Column", (String)null);
               var0.a(zase.y(var8.getColumn()));
               var0.b();
               if (var8.getStartRow() != 1) {
                  var0.c("x:RowStart", (String)null);
                  var0.a(zase.y(var8.getStartRow()));
                  var0.b();
               }

               var7 = var8.getEndRow() > 65535 ? '\uffff' : var8.getEndRow();
               if (var7 != 65535) {
                  var0.c("x:RowEnd", (String)null);
                  var0.a(zase.y(var7));
                  var0.b();
               }
            }

            var0.b();
         }

         var0.b();
      }

   }

   private static void c(zcfx var0, Worksheet var1, Workbook var2) throws Exception {
      for(int var3 = 0; var3 < var1.getValidations().getCount(); ++var3) {
         Validation var4 = var1.getValidations().get(var3);
         String[] var5 = zasp.a(var4, var1);
         StringBuilder var6 = new StringBuilder();
         var0.c("x:DataValidation", (String)null);
         new CellArea();
         if (var4.getAreaList().size() > 0) {
            CellArea var7 = (CellArea)var4.getAreaList().get(0);
         }

         var0.c("x:Range", (String)null);

         for(int var8 = 0; var8 < var4.getAreaList().size(); ++var8) {
            if (var8 != 0) {
               var6.append(',');
            }

            CellArea var9 = (CellArea)var4.getAreaList().get(var8);
            var6.append('R');
            var6.append(var9.StartRow + 1);
            var6.append('C');
            var6.append(var9.StartColumn + 1);
            if (var9.StartRow != var9.EndRow || var9.StartColumn != var9.EndColumn) {
               var6.append(':');
               var6.append('R');
               var6.append(var9.EndRow + 1);
               var6.append('C');
               var6.append(var9.EndColumn + 1);
            }
         }

         var0.a(com.aspose.cells.b.a.zr.a(var6));
         var0.b();
         if (var4.getType() != 0) {
            var0.c("x:Type", (String)null);
            switch(var4.getType()) {
            case 0:
               var0.a("AnyValue");
               break;
            case 1:
               var0.a("Whole");
               break;
            case 2:
               var0.a("Decimal");
               break;
            case 3:
               var0.a("List");
               break;
            case 4:
               var0.a("Date");
               break;
            case 5:
               var0.a("Time");
               break;
            case 6:
               var0.a("TextLength");
               break;
            case 7:
               var0.a("Custom");
            }

            var0.b();
         }

         String var10;
         if (var4.getType() == 3) {
            if (var5[0] != null && var5[0].endsWith("\"") && (var5[0].startsWith("\"") || var5[0].startsWith("=\""))) {
               var0.b("CellRangeList");
               var0.b();
            }

            if (var5[0] != null) {
               var0.c("x:Value", (String)null);
               var10 = var5[0];
               if (var10.charAt(0) == '=') {
                  var10 = var10.substring(1);
               }

               if (var10.charAt(0) == '"' && var10.charAt(var10.length() - 1) == '"') {
                  var10 = var10.replace('\u0000', ',');
               }

               var0.a(var10);
               var0.b();
            }
         } else {
            if (var4.getOperator() != 6) {
               var0.c("x:Qualifier", (String)null);
               switch(var4.getOperator()) {
               case 0:
                  var0.a("Between");
                  break;
               case 1:
                  var0.a("Equal");
                  break;
               case 2:
                  var0.a("Greater");
                  break;
               case 3:
                  var0.a("GreaterOrEqual");
                  break;
               case 4:
                  var0.a("Less");
                  break;
               case 5:
                  var0.a("LessOrEqual");
               case 6:
               default:
                  break;
               case 7:
                  var0.a("NotBetween");
                  break;
               case 8:
                  var0.a("NotEqual");
               }

               var0.b();
            }

            if ((var4.getOperator() == 0 || var4.getOperator() == 7) && var5[0] != null) {
               var0.c("x:Min", (String)null);
               var10 = var5[0];
               if (var10.charAt(0) == '=') {
                  var10 = var10.substring(1);
               }

               var0.a(var10);
               var0.b();
            }

            if ((var4.getOperator() == 0 || var4.getOperator() == 7) && var4.getFormula2() != null) {
               var0.c("x:Max", (String)null);
               var10 = var5[1];
               if (var10.charAt(0) == '=') {
                  var10 = var10.substring(1);
               }

               var0.a(var10);
               var0.b();
            }

            if (var4.getOperator() != 0 && var4.getOperator() != 7 && var5[0] != null) {
               var0.c("x:Value", (String)null);
               var10 = var5[0];
               if (var10.charAt(0) == '=') {
                  var10 = var10.substring(1);
               }

               var0.a(var10);
               var0.b();
            }
         }

         if (!var4.getIgnoreBlank()) {
            var0.c("x:UseBlank", (String)null);
            var0.b();
         }

         if (!var4.getInCellDropDown()) {
            var0.c("x:ComboHide", (String)null);
            var0.b();
         }

         if (var4.c() != 0) {
            var0.c("x:IMEMode", (String)null);
            switch(var4.c()) {
            case 1:
               var0.a("1");
               break;
            case 2:
               var0.a("2");
            }

            var0.b();
         }

         if (!var4.getShowInput()) {
            var0.c("x:InputHide", (String)null);
            var0.b();
         }

         if (!zasp.b(var4.getInputTitle())) {
            var0.c("x:InputTitle", (String)null);
            var0.a(var4.getInputTitle());
            var0.b();
         }

         if (!zasp.b(var4.getInputMessage())) {
            var0.c("x:InputMessage", (String)null);
            var0.a(var4.getInputMessage());
            var0.b();
         }

         if (!var4.getShowError()) {
            var0.c("x:ErrorHide", (String)null);
            var0.b();
         }

         if (var4.getAlertStyle() != 1) {
            var0.c("x:ErrorStyle", (String)null);
            switch(var4.getAlertStyle()) {
            case 0:
               var0.a("Info");
               break;
            case 2:
               var0.a("Warn");
            }

            var0.b();
         }

         if (!zasp.b(var4.getErrorMessage())) {
            var0.c("x:ErrorMessage", (String)null);
            var0.a(var4.getErrorMessage());
            var0.b();
         }

         if (!zasp.b(var4.getErrorTitle())) {
            var0.c("x:ErrorTitle", (String)null);
            var0.a(var4.getErrorTitle());
            var0.b();
         }

         var0.b();
      }

   }

   private static void d(zcfx var0, Worksheet var1, Workbook var2) throws Exception {
      var0.c("WorksheetOptions", (String)null);
      var0.a("xmlns", (String)null, (String)null, "urn:schemas-microsoft-com:office:excel");
      if (!var1.isVisible()) {
         var0.c("Visible", (String)null);
         var0.a("SheetHidden");
         var0.b();
      }

      if (!var1.isRowColumnHeadersVisible()) {
         var0.c("DoNotDisplayHeadings", (String)null);
         var0.b();
      }

      if (var1.getZoom() != 100) {
         var0.c("Zoom", (String)null);
         var0.a(zase.y(var1.getZoom()));
         var0.b();
      }

      PageSetup var3 = var1.getPageSetup();
      var0.c("PageSetup", (String)null);
      if (var3.getOrientation() != 1 || var3.getCenterHorizontally() || var3.getCenterVertically() || !var3.isAutoFirstPageNumber()) {
         var0.c("Layout", (String)null);
         if (var3.getOrientation() != 1) {
            var0.a("x:Orientation", (String)null, "Landscape");
         }

         if (var3.getCenterHorizontally()) {
            var0.a("x:CenterHorizontal", (String)null, "1");
         }

         if (var3.getCenterVertically()) {
            var0.a("x:CenterVertical", (String)null, "1");
         }

         if (!var3.isAutoFirstPageNumber()) {
            var0.a("x:StartPageNumber", (String)null, zase.y(var3.getFirstPageNumber()));
         }

         var0.b();
      }

      String var4 = var3.a(true, 1);
      if (var3.getHeaderMargin() != 1.27D || var4 != null && var4.length() > 0) {
         var0.c("Header", (String)null);
         if (var3.getHeaderMargin() != 1.27D) {
            var0.a("x:Margin", (String)null, zase.b(var3.getHeaderMargin() / 2.54D));
         }

         if (var4 != null && var4.length() > 0) {
            var0.a("x:Data", (String)null, var4);
         }

         var0.b();
      }

      String var5 = var3.a(false, 1);
      if (var3.getFooterMargin() != 1.27D || var5 != null && var5.length() > 0) {
         var0.c("Footer", (String)null);
         if (var3.getFooterMargin() != 1.27D) {
            var0.a("x:Margin", (String)null, zase.b(var3.getFooterMargin() / 2.54D));
         }

         if (var5 != null && var5.length() > 0) {
            var0.a("x:Data", (String)null, var5);
         }

         var0.b();
      }

      if (var3.getTopMargin() != 2.54D || var3.getBottomMargin() != 2.54D || var3.getLeftMargin() != 1.905D || var3.getRightMargin() != 1.905D) {
         var0.c("PageMargins", (String)null);
         if (var3.getTopMargin() != 2.54D) {
            var0.a("x:Top", (String)null, zase.b(var3.getTopMargin() / 2.54D));
         }

         if (var3.getBottomMargin() != 2.54D) {
            var0.a("x:Bottom", (String)null, zase.b(var3.getBottomMargin() / 2.54D));
         }

         if (var3.getLeftMargin() != 1.905D) {
            var0.a("x:Left", (String)null, zase.b(var3.getLeftMargin() / 2.54D));
         }

         if (var3.getRightMargin() != 1.905D) {
            var0.a("x:Right", (String)null, zase.b(var3.getRightMargin() / 2.54D));
         }

         var0.b();
      }

      var0.b();
      if (!var3.isPercentScale()) {
         var0.c("FitToPage", (String)null);
         var0.b();
      }

      var0.c("Print", (String)null);
      if (var3.e()) {
         var0.b("ValidPrinterInfo", (String)null);
      }

      if (var3.getFitToPagesWide() != 1) {
         var0.c("FitWidth", (String)null);
         var0.a(zase.y(var3.getFitToPagesWide()));
         var0.b();
      }

      if (var3.getFitToPagesTall() != 1) {
         var0.c("FitHeight", (String)null);
         var0.a(zase.y(var3.getFitToPagesTall()));
         var0.b();
      }

      if (var3.getOrder() == 1) {
         var0.c("LeftToRight", (String)null);
         var0.b();
      }

      if (var3.getBlackAndWhite()) {
         var0.c("BlackAndWhite", (String)null);
         var0.b();
      }

      if (var3.getPrintDraft()) {
         var0.c("DraftQuality", (String)null);
         var0.b();
      }

      if (var3.getPrintComments() != 1) {
         var0.c("CommentsLayout", (String)null);
         if (var3.getPrintComments() == 2) {
            var0.a("SheetEnd");
         } else if (var3.getPrintComments() == 0) {
            var0.a("InPlace");
         }

         var0.b();
      }

      if (var3.getPrintErrors() != 2) {
         var0.c("PrintErrors", (String)null);
         switch(var3.getPrintErrors()) {
         case 0:
            var0.a("Blank");
            break;
         case 1:
            var0.a("Dash");
         case 2:
         default:
            break;
         case 3:
            var0.a("NA");
         }

         var0.b();
      }

      if (var3.getZoom() != 100) {
         var0.c("Scale", (String)null);
         var0.a(zase.y(var3.getZoom()));
         var0.b();
      }

      var0.c("PaperSizeIndex", (String)null);
      switch(var3.getPaperSize()) {
      case 1:
         var0.a("119");
         break;
      default:
         var0.a(zase.y(var3.getPaperSize()));
      }

      var0.b();
      int var6 = var3.getPrintQuality();
      if (var6 != 300) {
         if (var6 < 0) {
            var6 = 600;
         }

         var0.c("HorizontalResolution", (String)null);
         var0.a(zase.y(var6));
         var0.b();
         var0.c("VerticalResolution", (String)null);
         var0.a(zase.y(var6));
         var0.b();
      }

      if (var3.getPrintGridlines()) {
         var0.c("Gridlines", (String)null);
         var0.b();
      }

      if (var3.getPrintHeadings()) {
         var0.c("RowColHeadings", (String)null);
         var0.b();
      }

      var0.b();
      if (!var1.isGridlinesVisible()) {
         var0.c("DoNotDisplayGridlines", (String)null);
         var0.b();
      }

      if (!var1.getDisplayZeros()) {
         var0.c("DoNotDisplayZeros", (String)null);
         var0.b();
      }

      if (var1.v() != -1 && var1.v() < 64) {
         var0.c("TabColorIndex", (String)null);
         var0.a(zase.y(var1.v()));
         var0.b();
      }

      a(var0, var1);
      var0.b();
   }

   private static void a(zcfx var0, Worksheet var1) throws Exception {
      if (var1.getFirstVisibleRow() != 0) {
         var0.b("TopRowVisible", zase.y(var1.getFirstVisibleRow()));
      }

      if (var1.getFirstVisibleColumn() != 0) {
         var0.b("LeftColumnVisible", zase.y(var1.getFirstVisibleColumn()));
      }

      if (var1.getPanes() != null) {
         PaneCollection var2 = var1.b();
         boolean var3 = !var1.h();
         if (!var3) {
            var0.b("FreezePanes", (String)null);
            var0.b("FrozenNoSplit", (String)null);
         }

         if ((double)var2.d() != 0.0D) {
            var0.b("SplitHorizontal", zase.y(var2.d()));
            var0.b("TopRowBottomPane", zase.y(var2.b()));
         }

         if ((double)var2.e() != 0.0D) {
            var0.b("SplitVertical", zase.y(var2.e()));
            var0.b("LeftColumnRightPane", zase.y(var2.c()));
         }

         var0.b("ActivePane", zase.a(var2.a()));
      }

      if (var1.s() != null && var1.s().size() != 0) {
         var0.b("Panes");

         for(int var5 = 0; var5 < var1.s().size(); ++var5) {
            zbci var6 = (zbci)((zbci)var1.s().get(var5));
            var0.b("Pane");
            var0.b("Number", zase.a(var6.a()));
            if (var6.c() != 0) {
               var0.b("ActiveRow", zase.y(var6.c()));
            }

            if (var6.d() != 0) {
               var0.b("ActiveCol", zase.y(var6.d()));
            }

            String var4 = zase.a((ArrayList)var6.b(), 0, (int)var6.b().size());
            var0.b("RangeSelection", var4);
            var0.b();
         }

         var0.b();
      }

   }

   private static zbbp a(Cells var0, int var1, int var2, Cell var3, ArrayList var4, int var5) {
      boolean var6 = false;
      Hyperlink var7 = null;
      Comment var8 = null;
      if (var5 < var4.size()) {
         zfu var9 = (zfu)var4.get(var5);
         if (var9.a == var1 && var9.b == var2) {
            var6 = true;
         }
      }

      HyperlinkCollection var13 = var0.h().getHyperlinks();

      for(int var10 = 0; var10 < var13.getCount(); ++var10) {
         Hyperlink var11 = var0.h().getHyperlinks().get(var10);
         if (var11.getArea().StartColumn <= var2 && var2 <= var11.getArea().EndColumn && var11.getArea().StartRow <= var1 && var1 <= var11.getArea().EndRow) {
            var7 = var11;
            break;
         }
      }

      CommentCollection var14 = var0.h().getComments();

      for(int var15 = 0; var15 < var14.getCount(); ++var15) {
         Comment var12 = var14.get(var15);
         if (var12.getRow() == var1 && var12.getColumn() == var2) {
            var8 = var12;
            break;
         }
      }

      if (!var6 && var3 == null && var7 == null && var8 == null) {
         return null;
      } else {
         zbbp var16 = new zbbp();
         var16.d = var6;
         if (var6) {
            var16.a = (zfu)var4.get(var5);
         }

         var16.c = var3;
         var16.b = var7;
         var16.e = var8;
         return var16;
      }
   }

   private static boolean a(Worksheet var0, int var1, ArrayList var2, int var3) {
      for(int var4 = var3; var4 < var2.size(); ++var4) {
         zfu var5 = (zfu)var2.get(var3);
         if (var5.a == var1) {
            return true;
         }

         if (var5.a > var1) {
            break;
         }
      }

      HyperlinkCollection var8 = var0.getHyperlinks();

      for(int var9 = 0; var9 < var8.getCount(); ++var9) {
         Hyperlink var6 = var8.get(var9);
         if (var6.getArea().StartRow <= var1 && var6.getArea().EndRow >= var1) {
            return true;
         }
      }

      CommentCollection var10 = var0.getComments();

      for(int var11 = 0; var11 < var10.getCount(); ++var11) {
         Comment var7 = var10.get(var11);
         if (var7.getRow() == var1) {
            return true;
         }
      }

      return false;
   }

   private static void a(Worksheet var0, ArrayList var1, boolean var2, boolean var3, int[] var4, int[] var5) {
      var4[0] = -1;
      if (var0.getCells().getRows().getCount() > 0) {
         var4[0] = var0.getCells().getRows().getRowByIndex(var0.getCells().getRows().getCount() - 1).getIndex();
      }

      var5[0] = var0.getCells().b((short)0);

      for(int var6 = 0; var6 < var1.size(); ++var6) {
         zfu var7 = (zfu)var1.get(var6);
         if (var2) {
            if (var7.c > var4[0]) {
               var4[0] = var7.c;
            }

            if (var7.d > var5[0]) {
               var5[0] = var7.d;
            }
         } else {
            if (var7.a > var4[0]) {
               var4[0] = var7.a;
            }

            if (var7.b > var5[0]) {
               var5[0] = var7.b;
            }
         }
      }

      HyperlinkCollection var10 = var0.getHyperlinks();

      for(int var11 = 0; var11 < var10.getCount(); ++var11) {
         Hyperlink var8 = var10.get(var11);
         if (var8.getArea().EndRow > var4[0]) {
            var4[0] = var8.getArea().EndRow;
         }

         if (var8.getArea().EndColumn > var5[0]) {
            var5[0] = var8.getArea().EndColumn;
         }
      }

      CommentCollection var12 = var0.getComments();

      for(int var13 = 0; var13 < var12.getCount(); ++var13) {
         Comment var9 = var12.get(var13);
         if (var9.getRow() > var4[0]) {
            var4[0] = var9.getRow();
         }

         if (var9.getColumn() > var5[0]) {
            var5[0] = var9.getColumn();
         }
      }

      if (var3 && var5[0] > 255) {
         var5[0] = 255;
      }

   }

   private static void a(zcfx var0, Worksheet var1, boolean var2, boolean var3, boolean var4) throws Exception {
      Workbook var5 = var1.getWorkbook();
      var0.b("Worksheet");
      var0.a("ss:Name", (String)null, var1.getName());
      Cells var6 = var1.getCells();
      if (var3) {
         var6.k();
      }

      if (var1.a() != null && !var1.getProtection().getAllowEditingObject()) {
         var0.a("ss:Protected", (String)null, "1");
      }

      a(var0, var1, var5);
      var0.c("ss:Table", (String)null);
      zani var7 = var1.getCells().q();
      ArrayList var8 = new ArrayList(var7.getCount());

      for(int var9 = 0; var9 < var7.getCount(); ++var9) {
         com.aspose.cells.b.a.a.ze.a(var8, (Object)(new zfu(var7.a(var9))));
      }

      Collections.sort(var8);
      short var45 = (short)((int)(var6.getStandardHeight() * 20.0D));
      a(var0, var1, var5, var8, var3);
      boolean var10 = true;
      new zfu();
      HashMap var12 = new HashMap();
      int var13 = 0;
      byte var14 = -1;
      byte var15 = -1;
      int[] var16 = new int[]{var14};
      int[] var17 = new int[]{var15};
      a(var1, var8, false, var3, var16, var17);
      int var47 = var16[0];
      int var48 = var17[0];
      RowCollection var18 = var6.getRows();
      zbbj var20 = new zbbj();
      Row var25 = null;
      int var26 = -1;
      zr var27 = var6.f();
      zahl var28 = null;
      zahl var29 = null;
      Cell var30 = null;
      boolean var31 = true;
      boolean var32 = true;
      int var50;
      if (var27.a() > 0) {
         var28 = var27.a(-1, -1, false);
         var50 = var28.a();
         var25 = new Row(var6, var18, var27.f(var50), false);
         var26 = var25.getIndex();
      }

      for(int var33 = 0; var33 <= var47; ++var33) {
         Row var19 = null;
         zbbj var21 = null;
         int var22 = 15;
         int var34;
         if (var26 == var33) {
            var19 = var25;
            var50 = var28.a();
            if (var50 < 0) {
               var25 = null;
               var26 = -1;
            } else {
               var25 = new Row(var6, var18, var27.f(var50), false);
               var26 = var25.getIndex();
            }
         } else if (var33 > var26 && var26 > -1) {
            while(true) {
               var50 = var28.a();
               if (var50 < 0) {
                  var25 = null;
                  var26 = -1;
                  break;
               }

               var34 = var27.a(var50);
               if (var34 == var33) {
                  var19 = new Row(var6, var18, var27.f(var50), false);
                  var50 = var28.a();
                  if (var50 < 0) {
                     var25 = null;
                     var26 = -1;
                  } else {
                     var25 = new Row(var6, var18, var27.f(var50), false);
                     var26 = var25.getIndex();
                  }
                  break;
               }

               if (var34 > var33) {
                  var25 = new Row(var6, var18, var27.f(var50), false);
                  var26 = var25.getIndex();
                  break;
               }
            }
         }

         if (var19 != null) {
            var21 = var19.a.a(var20, 15);
            var22 = var21.d() ? var21.d : 15;
         }

         if (var19 != null && (var19.a() != 0 || var22 != 15 || var21.b() || var21.e != var45) || a(var1, var33, var8, var13)) {
            var0.c("Row", (String)null);
            var0.a("ss:Index", (String)null, zase.y(var33 + 1));
            if (var19 != null) {
               if (var21.e != var45) {
                  var0.a("ss:Height", (String)null, zase.b((double)var21.e / 20.0D));
               }

               if (var22 != 15) {
                  var0.a("ss:StyleID", (String)null, "S" + zase.y(var22));
               }

               if (var21.b()) {
                  var0.a("ss:Hidden", (String)null, "1");
               }
            }

            int var46 = -1;
            int var49 = -1;
            if (var19 != null && var19.a() > 0) {
               var29 = var19.a.a(-1, -1, false);
               var50 = var29.a();
               var30 = new Cell(var19, var50);
               var49 = var30.getColumn();
            }

            for(var34 = 0; var34 <= var48; ++var34) {
               if (var12.get(var34) != null) {
                  zfu var35 = (zfu)var12.get(var34);
                  if (var33 > var35.c) {
                     var12.remove(var34);
                  } else if (var33 <= var35.c && var33 >= var35.a) {
                     var34 = var35.d;
                     continue;
                  }
               }

               Cell var24;
               int var52;
               if (var34 == var49) {
                  var24 = var30;
                  var50 = var29.a();
                  if (var50 < 0) {
                     var30 = null;
                     var49 = -1;
                  } else {
                     var30 = new Cell(var19, var50);
                     var49 = var30.c.a;
                  }
               } else {
                  var24 = null;
                  if (var49 > -1 && var49 < var34) {
                     while(true) {
                        var50 = var29.a();
                        if (var50 < 0) {
                           var30 = null;
                           var49 = -1;
                           break;
                        }

                        var52 = var19.a.a(var50);
                        if (var52 == var34) {
                           var24 = new Cell(var19, var50);
                           var50 = var29.a();
                           if (var50 < 0) {
                              var30 = null;
                              var49 = -1;
                           } else {
                              var30 = new Cell(var19, var50);
                              var49 = var30.c.a;
                           }
                           break;
                        }

                        if (var52 > var34) {
                           var30 = new Cell(var19, var50);
                           var49 = var30.c.a;
                           break;
                        }
                     }
                  }
               }

               zbbp var23 = a(var6, var33, var34, var24, var8, var13);
               if (var23 != null) {
                  var0.c("Cell", (String)null);
                  if (var4 || var34 - var46 > 1) {
                     var0.a("ss:Index", (String)null, zase.y(var34 + 1));
                  }

                  var46 = var34;
                  if (var23.d) {
                     zfu var11 = var23.a;
                     var12.put(var34, var11);
                     var0.a("ss:MergeAcross", (String)null, zase.y(var11.d - var34));
                     var34 = var11.d;
                     var0.a("ss:MergeDown", (String)null, zase.y(var11.c - var33));
                     ++var13;
                  }

                  var52 = 15;
                  int var36 = -1;
                  if (var23.c != null) {
                     var52 = var23.c.r();
                     var36 = var23.c.s();
                  }

                  boolean var37 = false;
                  int var38;
                  if (var52 != 15) {
                     if (var22 != 15) {
                        if (var52 != var22) {
                           var37 = true;
                        }
                     } else {
                        var38 = var6.d.a(var34);
                        if (var38 < 0) {
                           var38 = 15;
                        }

                        if (var52 != var38) {
                           var37 = true;
                        }
                     }
                  } else if (var36 == 15) {
                     if (var19.j()) {
                        var37 = true;
                     }

                     if (!var37) {
                        var38 = var6.d.a(var34);
                        var37 = var38 != -1 && var38 != 15;
                     }
                  }

                  if (var37) {
                     if (var36 == 15) {
                        var0.a("ss:StyleID", (String)null, "Default");
                     } else {
                        var0.a("ss:StyleID", (String)null, "S" + var52);
                     }
                  }

                  String var53;
                  if (var23.b != null) {
                     var53 = var23.b.getAddress();
                     if (var23.b.a(var1.c()) == 2) {
                        var53 = "#" + var53;
                     }

                     var0.a("ss:HRef", (String)null, var53);
                     if (var23.b.getScreenTip() != null && !"".equals(var23.b.getScreenTip())) {
                        var0.a("x:HRefScreenTip", (String)null, var23.b.getScreenTip());
                     }
                  }

                  if (var23.c != null) {
                     var24 = var23.c;
                     var53 = "String";
                     String var39 = null;
                     zfv var40 = var24.c.d();
                     switch(var40.c) {
                     case 1:
                        var53 = "Number";
                        var39 = var24.c.a(true);
                        break;
                     case 2:
                        var53 = "Boolean";
                        var39 = (Boolean)var40.d ? "1" : "0";
                        break;
                     case 3:
                        var39 = var40.f();
                        break;
                     case 4:
                        var39 = (String)var40.d;
                     case 5:
                     default:
                        break;
                     case 6:
                        var53 = "Number";
                        var39 = com.aspose.cells.b.a.zo.a((Integer)var40.d);
                     }

                     if (var24.f() && ((zyi)var24.c.d).b != null) {
                        if (var24.y()) {
                           if (var24.isArrayHeader()) {
                              CellArea var41 = var24.D().a();

                              assert var41.StartRow == var24.getRow();

                              assert var41.StartColumn == var24.getColumn();

                              StringBuilder var42 = new StringBuilder();
                              var42.append("RC:");
                              var42.append('R');
                              if (var41.EndRow != var24.getRow()) {
                                 var42.append('[');
                                 var42.append(var41.EndRow - var24.getRow());
                                 var42.append(']');
                              }

                              var42.append('C');
                              if (var41.EndColumn != var24.getColumn()) {
                                 var42.append('[');
                                 var42.append(var41.EndColumn - var24.getColumn());
                                 var42.append(']');
                              }

                              var0.a("ss:ArrayRange", (String)null, com.aspose.cells.b.a.zr.a(var42));
                              var0.a("ss:Formula", (String)null, var5.getWorksheets().c().a(var24));
                           }
                        } else {
                           var0.a("ss:Formula", (String)null, var5.getWorksheets().c().a(var24));
                        }
                     }

                     if (var39 != null && var39.length() > 0) {
                        var0.a((int)0);
                        boolean var54 = var24.I();
                        if (var54) {
                           var0.c("ss:Data", (String)null);
                        } else {
                           var0.c("Data", (String)null);
                        }

                        var0.a("ss:Type", (String)null, var53);
                        if (var54) {
                           var0.a((String)null, "xmlns", (String)null, "http://www.w3.org/TR/REC-html40");
                           FontSetting[] var55 = var24.getCharacters();

                           for(int var43 = 0; var43 < var55.length; ++var43) {
                              FontSetting var44 = var55[var43];
                              a(var0, var44, var39.substring(var44.getStartIndex(), var44.getStartIndex() + var44.getLength()));
                           }
                        } else if ("String".equals(var53)) {
                           if (var39.indexOf(10) != -1) {
                              var39 = zaff.a(var39);
                              var0.d(var39);
                           } else {
                              var0.a(var39);
                           }
                        } else {
                           var0.a(var39);
                        }

                        var0.b();
                        if (var2) {
                           var0.a((int)1);
                        }
                     }
                  }

                  if (var23.e != null) {
                     a(var0, var23.e);
                  }

                  var0.b();
               }
            }

            var0.b();
         }
      }

      var0.b();
      d(var0, var1, var5);
      b(var0, var1, var5);
      c(var0, var1, var5);
      b(var0, var1);
      zbbq var51 = new zbbq(var0, var1, var5);
      var51.a();
      var0.b();
   }

   private static void a(zcfx var0, Comment var1) throws Exception {
      if (var1.getNote() != null && !"".equals(var1.getNote())) {
         var0.c("ss:Comment", (String)null);
         if (var1.isVisible()) {
            var0.a("ss:ShowAlways", (String)null, "1");
         }

         var0.a((int)0);
         var0.c("ss:Data", (String)null);
         zbtz var2 = var1.b();
         String var3 = var2.i();
         if (var2.p() != null && var2.p().size() != 0) {
            var0.a((String)null, "xmlns", (String)null, "http://www.w3.org/TR/REC-html40");
            ArrayList var4 = var2.s();

            for(int var5 = 0; var5 < var4.size(); ++var5) {
               FontSetting var6 = (FontSetting)var4.get(var5);
               a(var0, var6, var3.substring(var6.getStartIndex(), var6.getStartIndex() + var6.getLength()));
            }
         } else if (var3.indexOf(10) != -1) {
            var3 = zaff.a(var3);
            var0.d(var3);
         } else {
            var0.a(var3);
         }

         var0.b();
         var0.a((int)1);
         var0.b();
      }

   }

   private static void a(zcfx var0, FontSetting var1, String var2) throws Exception {
      Font var3 = var1.getFont();
      if (var3 != null) {
         int var4 = 0;
         if (var3.isBold()) {
            var0.c("B", (String)null);
            ++var4;
         }

         if (var3.isItalic()) {
            var0.c("I", (String)null);
            ++var4;
         }

         if (var3.isSubscript()) {
            var0.c("Sub", (String)null);
            ++var4;
         }

         if (var3.isSuperscript()) {
            var0.c("Sup", (String)null);
            ++var4;
         }

         if (var3.isStrikeout()) {
            var0.c("S", (String)null);
            ++var4;
         }

         if (var3.getUnderline() != 0) {
            var0.c("U", (String)null);
            switch(var3.getUnderline()) {
            case 2:
               var0.a("html:Style", (String)null, "text-underline:double");
               break;
            case 3:
               var0.a("html:Style", (String)null, "text-underline:single-accounting");
               break;
            case 4:
               var0.a("html:Style", (String)null, "text-underline:double-accounting");
            }

            ++var4;
         }

         var0.c("Font", (String)null);
         var0.a("html:Face", (String)null, var3.getName());
         var0.a("html:Color", (String)null, zasp.a(var3.getColor()));
         var0.a("html:Size", (String)null, zase.b(var3.getDoubleSize()));
         if (var2.indexOf(10) != -1) {
            var2 = zaff.a(var2);
            var0.d(var2);
         } else {
            var0.a(var2);
         }

         var0.b();

         for(int var5 = 0; var5 < var4; ++var5) {
            var0.b();
         }
      } else {
         var0.c("Font", (String)null);
         if (var2.indexOf(10) != -1) {
            var2 = zaff.a(var2);
            var0.d(var2);
         } else {
            var0.a(var2);
         }

         var0.b();
      }

   }

   private static void b(zcfx var0, Worksheet var1) throws Exception {
      if (var1.hasAutofilter()) {
         AutoFilter var2 = var1.getAutoFilter();
         String var3 = zase.b(var2.h());
         var0.b("AutoFilter");
         var0.a("x:Range", (String)null, var3);
         var0.a((String)null, "xmlns", (String)null, "urn:schemas-microsoft-com:office:excel");
         if (var1.getAutoFilter().e != null && var1.getAutoFilter().e.getCount() > 0) {
            FilterColumnCollection var4 = var1.getAutoFilter().e;

            for(int var5 = 0; var5 < var4.getCount(); ++var5) {
               FilterColumn var6 = var4.getByIndex(var5);
               if (var6 != null) {
                  zvo var7 = new zvo(var6);
                  if (var7.d()) {
                     var0.b("AutoFilterColumn");
                     var0.a("x:Index", zase.y(var6.getFieldIndex() + 1));
                     String var8 = "Top";
                     boolean var9 = false;
                     boolean var10 = false;
                     byte var11 = 0;
                     boolean[] var12 = new boolean[]{var9};
                     boolean[] var13 = new boolean[]{var10};
                     int[] var14 = new int[]{var11};
                     var7.a(var12, var13, var14);
                     var9 = var12[0];
                     var10 = var13[0];
                     int var15 = var14[0];
                     if (var9) {
                        if (var10) {
                           var8 = "TopPercent";
                        } else {
                           var8 = "Top";
                        }
                     } else if (var10) {
                        var8 = "BottomPercent";
                     } else {
                        var8 = "Bottom";
                     }

                     var0.a("x:Type", var8);
                     var0.a("x:Value", zase.y(var15));
                     var0.b();
                  } else if (var7.c != 6 || var7.d != 6) {
                     var0.b("AutoFilterColumn");
                     var0.a("x:Index", zase.y(var6.getFieldIndex() + 1));
                     if (var7.d == 6) {
                        if (var7.f == null && (var7.c == 2 || var7.d == 4)) {
                           if (var7.c == 2) {
                              var0.a("x:Type", "Blanks");
                           } else {
                              var0.a("x:Type", "NonBlanks");
                           }
                        } else {
                           var0.a("x:Type", "Custom");
                           var0.b("AutoFilterCondition");
                           var0.a("x:Operator", a(var7.c));
                           if (var7.f != null) {
                              var0.a("x:Value", AutoFilter.b(var7.f));
                           }

                           var0.b();
                        }
                     } else {
                        var0.a("x:Type", "Custom");
                        if (var7.a()) {
                           var0.b("AutoFilterAnd");
                        } else {
                           var0.b("AutoFilterOr");
                        }

                        var0.b("AutoFilterCondition");
                        var0.a("x:Operator", a(var7.c));
                        if (var7.f != null) {
                           var0.a("x:Value", AutoFilter.b(var7.f));
                        }

                        var0.b();
                        var0.b("AutoFilterCondition");
                        var0.a("x:Operator", a(var7.d));
                        if (var7.e != null) {
                           var0.a("x:Value", AutoFilter.b(var7.e));
                        }

                        var0.b();
                        var0.b();
                     }

                     var0.b();
                  }
               }
            }
         }

         var0.b();
      }
   }

   static String a(int var0) {
      switch(var0) {
      case 0:
         return "LessThanOrEqual";
      case 1:
         return "LessThan";
      case 2:
         return "Equals";
      case 3:
         return "GreaterThan";
      case 4:
         return "DoesNotEqual";
      case 5:
         return "GreaterThanOrEqual";
      default:
         return "Equals";
      }
   }

   private static void a(zcfx var0, Worksheet var1, Column var2, int var3) throws Exception {
      int var4 = var2.c();
      double var5 = (double)((float)zkp.b(var2.a, var1.c()) * 72.0F / (float)var1.c().M());
      var0.c("Column", (String)null);
      var0.a("ss:Index", (String)null, zase.y(var2.getIndex() + 1));
      if (var3 != 0) {
         var0.a("ss:Span", (String)null, zase.y(var3));
      }

      if (var4 >= 0 && var4 != 15) {
         var0.a("ss:StyleID", (String)null, "S" + zase.y(var4));
      }

      if (var2.isHidden()) {
         var0.a("ss:Hidden", (String)null, "1");
      }

      if (var5 >= 0.0D) {
         var0.a("ss:AutoFitWidth", (String)null, "0");
         var0.a("ss:Width", (String)null, zase.b(var5));
      }

      var0.b();
   }

   private static void a(zcfx var0, Worksheet var1, Workbook var2, ArrayList var3, boolean var4) throws Exception {
      Cells var5 = var1.getCells();
      var0.a("ss:DefaultRowHeight", (String)null, zase.b(var5.getStandardHeight()));
      byte var6 = -1;
      byte var7 = -1;
      int[] var8 = new int[]{var7};
      int[] var9 = new int[]{var6};
      a(var1, var3, true, var4, var8, var9);
      int var22 = var8[0];
      int var21 = var9[0];
      ColumnCollection var10 = var1.getCells().getColumns();
      if (var10.getCount() > 0) {
         Column var11 = var10.getColumnByIndex(var10.getCount() - 1);
         if (var11.getIndex() > var21) {
            var21 = var11.getIndex();
         }
      }

      double var23 = (double)zkp.b(var10.b(), var2.getWorksheets());
      if (var10.b != null && var10.b.isHidden()) {
         var0.a("ss:DefaultColumnWidth", (String)null, "0");
      } else {
         var0.a("ss:DefaultColumnWidth", (String)null, zase.b(var23 * 72.0D / (double)var1.c().M()));
      }

      if (var4) {
         var21 = var21 > 255 ? 255 : var21;
         var22 = var22 > 65535 ? '\uffff' : var22;
      }

      if (var22 > 0) {
         var0.a("ss:ExpandedRowCount", (String)null, zase.y(var22 + 1));
      }

      if (var21 > 0) {
         var0.a("ss:ExpandedColumnCount", (String)null, zase.y(var21 + 1));
      }

      if (var10.b != null && var10.b.c() > 15) {
         var0.a("ss:StyleID", (String)null, "S" + zase.y(var10.b.c()));
      }

      int var13 = 16383;
      if (var4) {
         var13 = 255;
      }

      Column var14 = null;
      if (var10.b != null && var10.b.getIndex() != 0 && var10.b.j()) {
         var13 = var10.b.getIndex();
         var14 = new Column(0, var1, var10.b());
      }

      int var15 = 0;

      for(int var16 = 0; var16 < var10.getCount(); ++var16) {
         Column var17 = var10.getColumnByIndex(var16);
         int var18;
         if (var17.getIndex() - var15 != 0 && var14 != null && var15 < var13) {
            var18 = var13 > var17.getIndex() ? var17.getIndex() : var13;
            var14.a(var15);
            a(var0, var1, var14, var18 - var15 - 1);
         }

         var18 = 0;

         for(int var19 = var16 + 1; var19 < var10.getCount(); ++var19) {
            Column var20 = var10.getColumnByIndex(var19);
            if (var20.getIndex() != var17.getIndex() + 1 + var18 || !var17.b(var20)) {
               break;
            }

            ++var18;
         }

         a(var0, var1, var17, var18);
         var16 += var18;
         var15 = var17.getIndex() + 1 + var18;
      }

   }

   private static void a(Workbook var0, zcfx var1) throws Exception {
      var1.c("Styles", (String)null);
      HashMap var2 = new HashMap();
      zbvx var3 = var0.getWorksheets().B();

      Style var6;
      for(int var4 = 0; var4 < var3.getCount(); ++var4) {
         Style var5 = var0.getWorksheets().B().a(var4);
         if (var5.g()) {
            var2.put(var4, (Object)null);

            for(var6 = var5; var6.h() != 4095 && var6.h() > 0 && !var2.containsKey(var6.h()); var6 = var3.a(var6.h())) {
               var2.put(var6.h(), (Object)null);
            }
         }
      }

      StyleCollection var12 = var0.getStyles();

      for(int var13 = 0; var13 < var12.getCount(); ++var13) {
         var6 = var12.get(var13);
         Style var7 = var6;

         while(var7.h() != 4095 && var7.h() > 0 && !var2.containsKey(var7.h())) {
            var2.put(var7.h(), (Object)null);
            if (var7.h() < var3.getCount()) {
               var7 = var3.a(var7.h());
            } else {
               var7 = var12.get(var7.h() - var3.getCount());
            }
         }
      }

      ArrayList var14 = new ArrayList(var2.size());
      com.aspose.cells.b.a.a.zc var15 = com.aspose.cells.b.a.a.zf.a(var2);

      while(var15.c()) {
         com.aspose.cells.b.a.a.ze.a(var14, var15.a());
      }

      Collections.sort(var14);
      HashMap var16 = new HashMap();

      for(int var8 = 0; var8 < var14.size(); ++var8) {
         int var10 = (Integer)var14.get(var8);
         Style var9;
         if (var10 >= var3.getCount()) {
            var9 = var0.getStyles().get(var10 - var3.getCount());
         } else {
            var9 = var3.a(var10);
         }

         if (var9.g()) {
            Style var11 = var3.a(var9.h());
            if (var11.d(var9)) {
               if (var11.getName() != null && !"".equals(var11.getName())) {
                  if (var16.get(var11.getName()) == null) {
                     var9.a(var11.getName());
                     var16.put(var11.getName(), 0);
                  } else {
                     var9.a((String)null);
                  }
               }
            } else if (var9.getName() != null && !"".equals(var9.getName()) && var16.get(var9.getName()) != null) {
               var9.a((String)null);
            }
         }

         a(var0, var9, var10, var1);
      }

      var1.b();
   }

   private static void a(Workbook var0, Style var1, int var2, zcfx var3) throws Exception {
      var3.c("Style", (String)null);
      String var4 = var2 == 15 ? "Default" : "S" + var2;
      var3.a("ss:ID", (String)null, var4);
      int var5 = var1.h();
      boolean var6 = false;
      if (var2 == 15) {
         Style var7 = var0.getWorksheets().B().a(0);
         if (var1.getFont().a(var7.getFont())) {
            var3.a("ss:Name", (String)null, "Normal");
         }
      } else if (var5 != 4095 && var5 > 0 && var5 != 15) {
         var6 = true;
         var3.a("ss:Parent", (String)null, "S" + var5);
      } else if (var1.getName() != null && var1.getName().length() != 0) {
         var3.a("ss:Name", (String)null, var1.getName());
      }

      if (var1.l() || var1.getHorizontalAlignment() != 5 || var1.getVerticalAlignment() != 1 || var1.isTextWrapped() || var1.getIndentLevel() != 0 || var1.getShrinkToFit() || var1.getRotationAngle() != 0 || var1.getTextDirection() != 0) {
         var3.c("ss:Alignment", (String)null);
         String var8;
         if (var1.getHorizontalAlignment() != 5) {
            switch(var1.getHorizontalAlignment()) {
            case 1:
               var8 = "Center";
               break;
            case 2:
               var8 = "CenterAcrossSelection";
               break;
            case 3:
               var8 = "Distributed";
               break;
            case 4:
               var8 = "Fill";
               break;
            case 5:
            default:
               var8 = "Automatic";
               break;
            case 6:
               var8 = "Justify";
               break;
            case 7:
               var8 = "Left";
               break;
            case 8:
               var8 = "Right";
            }

            var3.a("ss:Horizontal", (String)null, var8);
         }

         if (var1.isModified(26) || var1.getVerticalAlignment() != 1) {
            switch(var1.getVerticalAlignment()) {
            case 0:
               var8 = "Bottom";
               break;
            case 1:
               var8 = "Center";
               break;
            case 2:
            case 4:
            case 5:
            case 7:
            case 8:
            default:
               var8 = "Automatic";
               break;
            case 3:
               var8 = "Distributed";
               break;
            case 6:
               var8 = "Justify";
               break;
            case 9:
               var8 = "Top";
            }

            var3.a("ss:Vertical", (String)null, var8);
         }

         if (var1.isTextWrapped()) {
            var3.a("ss:WrapText", (String)null, "1");
         }

         if (var1.getIndentLevel() != 0) {
            var3.a("ss:Indent", (String)null, zase.y(var1.getIndentLevel()));
         }

         if (var1.getShrinkToFit()) {
            var3.a("ss:ShrinkToFit", (String)null, "1");
         }

         if (var1.getRotationAngle() == 255) {
            var3.a("ss:VerticalText", (String)null, "1");
         } else if (var1.getRotationAngle() != 0) {
            var3.a("ss:Rotate", (String)null, zase.y(var1.getRotationAngle()));
         }

         switch(var1.getTextDirection()) {
         case 1:
            var3.a("ss:ReadingOrder", (String)null, "LeftToRight");
            break;
         case 2:
            var3.a("ss:ReadingOrder", (String)null, "RightToLeft");
         }

         var3.b();
      }

      if (a(var1)) {
         var3.c("ss:Borders", (String)null);
         BorderCollection var9 = var1.getBorders();
         if (var9.getByBorderType(1).getLineStyle() != 0) {
            a(var9.getByBorderType(1), var3, "Left");
         }

         if (var9.getByBorderType(4).getLineStyle() != 0) {
            a(var9.getByBorderType(4), var3, "Top");
         }

         if (var9.getByBorderType(2).getLineStyle() != 0) {
            a(var9.getByBorderType(2), var3, "Right");
         }

         if (var9.getByBorderType(8).getLineStyle() != 0) {
            a(var9.getByBorderType(8), var3, "Bottom");
         }

         if (var9.f() != 0) {
            if (var9.getByBorderType(32).getLineStyle() != 0) {
               a(var9.getByBorderType(32), var3, "DiagonalRight");
            }

            if (var9.getByBorderType(16).getLineStyle() != 0) {
               a(var9.getByBorderType(16), var3, "DiagonalLeft");
            }
         }

         var3.b();
      } else if ((var1.getName() != null && !"".equals(var1.getName()) || var6) && var1.m()) {
         var3.c("ss:Borders", (String)null);
         var3.b();
      }

      a(var1.getFont(), var3);
      if (var1.getPattern() != 0) {
         b(var1, var3);
      } else if (var1.getName() != null && !"".equals(var1.getName()) && (var1.i() & 255 & 64) != 0) {
         var3.c("ss:Interior", (String)null);
         var3.b();
      }

      if (var1.getNumber() == 0 && (var1.getCustom() == null || var1.getCustom().length() == 0)) {
         if (var1.j()) {
            if (var1.getName() != null && !"".equals(var1.getName())) {
               var3.c("ss:NumberFormat", (String)null);
               var3.b();
            } else if (var1.h() != 4095 && var1.h() != -1) {
               var3.c("ss:NumberFormat", (String)null);
               var3.b();
            }
         }
      } else {
         a(var1, var3);
      }

      if (var1.o()) {
         var3.c("ss:Protection", (String)null);
         var3.a("ss:Protected", (String)null, var1.isLocked() ? "1" : "0");
         var3.a("x:HideFormula", (String)null, var1.isFormulaHidden() ? "1" : "0");
         var3.b();
      }

      var3.b();
   }

   private static void a(Style var0, zcfx var1) throws Exception {
      var1.c("ss:NumberFormat", (String)null);
      String var2 = "General";
      if (var0.getCustom() != null && var0.getCustom().length() != 0) {
         var2 = var0.getCustom();
      } else if (var0.getNumber() != 0) {
         var2 = var0.e().n().getSettings().e().d(var0.getNumber());
         if (var2 == null) {
            var2 = "General";
         }
      }

      var1.a("ss:Format", (String)null, var2);
      var1.b();
   }

   private static void b(Style var0, zcfx var1) throws Exception {
      var1.c("ss:Interior", (String)null);
      if (var0.getPattern() != 1) {
         if (!var0.getForegroundColor().isEmpty()) {
            var1.a("ss:PatternColor", (String)null, zasp.a(var0.getForegroundColor()));
         }

         if (!var0.getBackgroundColor().isEmpty()) {
            var1.a("ss:Color", (String)null, zasp.a(var0.getBackgroundColor()));
         }
      } else if (!var0.getForegroundColor().isEmpty()) {
         var1.a("ss:Color", (String)null, zasp.a(var0.getForegroundColor()));
      }

      String var2 = null;
      switch(var0.getPattern()) {
      case 1:
         var2 = "Solid";
         break;
      case 2:
         var2 = "Gray50";
         break;
      case 3:
         var2 = "Gray75";
         break;
      case 4:
         var2 = "Gray25";
         break;
      case 5:
         var2 = "HorzStripe";
         break;
      case 6:
         var2 = "VertStripe";
         break;
      case 7:
         var2 = "ReverseDiagStripe";
         break;
      case 8:
         var2 = "DiagStripe";
         break;
      case 9:
         var2 = "DiagCross";
         break;
      case 10:
         var2 = "ThickDiagCross";
         break;
      case 11:
         var2 = "ThinHorzStripe";
         break;
      case 12:
         var2 = "ThinVertStripe";
         break;
      case 13:
         var2 = "ThinReverseDiagStripe";
         break;
      case 14:
         var2 = "ThinDiagStripe";
         break;
      case 15:
         var2 = "ThinHorzCross";
         break;
      case 16:
         var2 = "ThinDiagCross";
         break;
      case 17:
         var2 = "Gray125";
         break;
      case 18:
         var2 = "Gray0625";
      }

      if (var2 != null) {
         var1.a("ss:Pattern", (String)null, var2);
      }

      var1.b();
   }

   private static void a(Font var0, zcfx var1) throws Exception {
      var1.c("ss:Font", (String)null);
      if (var0.isBold()) {
         var1.a("ss:Bold", (String)null, "1");
      }

      if (!var0.getColor().isEmpty() && var0.getColor() != Color.getBlack()) {
         var1.a("ss:Color", (String)null, zasp.a(var0.getColor()));
      }

      var1.a("ss:FontName", (String)null, var0.getName());
      var1.a("ss:Size", (String)null, zase.y(var0.getSize()));
      if (var0.isItalic()) {
         var1.a("ss:Italic", (String)null, "1");
      }

      if (var0.isStrikeout()) {
         var1.a("ss:StrikeThrough", (String)null, "1");
      }

      String var2 = null;
      switch(var0.getUnderline()) {
      case 1:
         var2 = "Single";
         break;
      case 2:
         var2 = "Double";
         break;
      case 3:
         var2 = "SingleAccounting";
         break;
      case 4:
         var2 = "DoubleAccounting";
      }

      if (var2 != null) {
         var1.a("ss:Underline", (String)null, var2);
      }

      if (var0.isSubscript()) {
         var1.a("ss:VerticalAlign", (String)null, "Subscript");
      } else if (var0.isSuperscript()) {
         var1.a("ss:VerticalAlign", (String)null, "Superscript");
      }

      var1.b();
   }

   private static boolean a(Style var0) {
      BorderCollection var1 = var0.getBorders();
      return var1.getByBorderType(8).getLineStyle() != 0 || var1.getByBorderType(16).getLineStyle() != 0 || var1.getByBorderType(32).getLineStyle() != 0 || var1.getByBorderType(1).getLineStyle() != 0 || var1.getByBorderType(2).getLineStyle() != 0 || var1.getByBorderType(4).getLineStyle() != 0;
   }

   private static void a(Border var0, zcfx var1, String var2) throws Exception {
      var1.c("ss:Border", (String)null);
      var1.a("ss:Position", (String)null, var2);
      var1.a("ss:Color", (String)null, zasp.a(var0.getColor()));
      String var3 = null;
      double var4 = 0.0D;
      String[] var6 = new String[]{var3};
      double[] var7 = new double[]{var4};
      a(var0.getLineStyle(), var6, var7);
      var3 = var6[0];
      var4 = var7[0];
      var1.a("ss:LineStyle", (String)null, var3);
      var1.a("ss:Weight", (String)null, zase.b(var4));
      var1.b();
   }

   private static void a(int var0, String[] var1, double[] var2) {
      var1[0] = "Continuous";
      var2[0] = 1.0D;
      switch(var0) {
      case 0:
         var1[0] = "None";
         var2[0] = 0.0D;
         break;
      case 1:
         var1[0] = "Continuous";
         var2[0] = 1.0D;
         break;
      case 2:
         var1[0] = "Continuous";
         var2[0] = 2.0D;
         break;
      case 3:
         var1[0] = "Dash";
         var2[0] = 1.0D;
         break;
      case 4:
         var1[0] = "Dot";
         var2[0] = 1.0D;
         break;
      case 5:
         var1[0] = "Continuous";
         var2[0] = 3.0D;
         break;
      case 6:
         var1[0] = "Double";
         var2[0] = 3.0D;
         break;
      case 7:
         var1[0] = "Continuous";
         var2[0] = 0.0D;
         break;
      case 8:
         var1[0] = "Dash";
         var2[0] = 2.0D;
         break;
      case 9:
         var1[0] = "DashDot";
         var2[0] = 1.0D;
         break;
      case 10:
         var1[0] = "DashDot";
         var2[0] = 2.0D;
         break;
      case 11:
         var1[0] = "DashDotDot";
         var2[0] = 1.0D;
         break;
      case 12:
         var1[0] = "DashDotDot";
         var2[0] = 2.0D;
         break;
      case 13:
         var1[0] = "SlantDashDot";
         var2[0] = 2.0D;
         break;
      default:
         assert false : "unknown border type.";
      }

   }
}
